<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:fbi="http://www.fbifaces.org"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .input-col-m {
                width: 60px;
            }

            .input-col-l {
                width: 80px;
            }

            .input-col-xxl {
                width: 1%;
                text-align: right;
            }

            .col-95 {
                text-align: right;
            }

            .col-5 {
                text-align: left;
            }
        </style>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/dialogwindow.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }
            function recordEdit(obj) {
                var pkid = obj.parentNode.parentNode.children[0].innerHTML;
                var statusflag = obj.parentNode.parentNode.children[1].innerHTML;
                if (statusflag != "N") {
                    alert("账户已开启或结束监管，不能修改!");
                    return false;
                }
                var sfeature = "dialogwidth:800px; dialogheight:520px;center:yes;help:yes;resizable:yes;scroll:yes;status:yes";
                var arg = new Object();
                arg.doType = "edit";
                var rtn = dialog("accountEdit.xhtml?actPKID=" + pkid + "&amp;doType=eidt", arg, sfeature);
                if (rtn == "1") {
                    document.getElementById("actqueryForm:btnQuery").click();
                }
            }
        </script>

    </ui:define>

    <ui:define name="content">
        <div style="margin:5px;" id="top">
            <p:growl id="msgs" showDetail="false"/>
            <h:form id="actqueryForm">
                <p:panel id="query" header="【监管账户信息】查询">
                    <h:panelGrid columns="2" cellspacing="3" style="width:100%">
                        <h:panelGrid columns="4" cellspacing="3" style="width:80%" columnClasses="col-95,col-5">

                            <h:outputLabel value="监管账号:" for="accountCode"/>
                            <h:inputText autocomplete="off" id="accountCode" style="width:192px;"
                                         value="#{accountAction.account.accountCode}">
                            </h:inputText>

                            <h:outputLabel value="账户名称:" for="accountName"/>
                            <p:inputText id="accountName" value="#{accountAction.account.accountName}"
                                         style="width:192px;"/>
                        </h:panelGrid>
                        <h:panelGrid style="width:20%" columns="1" cellspacing="3">
                            <p:commandButton style="margin-left:15px;width:90px" ajax="false" update="msgs"
                                             action="#{accountAction.onBtnQueryClick}" id="btnQuery" value="查询">
                            </p:commandButton>
                            <!--<p:commandButton ajax="false" id="resetBtn" value="Excel导出"
                                             style="width:90px;margin-left:15px">
                                <fbi:DataExporter target="pdt" type="xls" titleName="账户信息" fileName="company_account"
                                                  excludeColumns="0,1,11"
                                                  excludeColumnsWidth="15,15,15,15,15,14,14,12,12"/>
                            </p:commandButton>-->
                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>

                <p:dataTable id="pdt" style="width:100%;"
                             dynamic="true" selectionMode="single"
                             value="#{accountAction.accountList}" var="record"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true" rows="15" paginatorPosition="bottom"
                             rowsPerPageTemplate="100,50,30,15,5"
                             emptyMessage="数据记录为空...">
                    <p:column headerText="pkid" style="display:none;">
                        <h:outputText value="#{record.pkId}"/>
                    </p:column>
                    <p:column headerText="statusflag" style="display:none;">
                        <h:outputText value="#{record.statusFlag}"/>
                    </p:column>

                    <p:column headerText="监管账号" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="监管账号"/>
                        </f:facet>
                        <h:outputText value="#{record.accountCode}" style="text-align: center;"/>
                    </p:column>

                    <p:column headerText="账户名称" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="账户名称"/>
                        </f:facet>
                        <h:outputText value="#{record.accountName}" style="text-align: right"/>
                    </p:column>

                    <p:column headerText="项目名称" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="项目名称"/>
                        </f:facet>
                        <h:outputText value="#{record.proName}" style="text-align: right"/>
                    </p:column>

                    <p:column headerText="项目地址" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="项目地址"/>
                        </f:facet>
                        <h:outputText value="#{record.proAddr}" style="text-align: right"/>
                    </p:column>

                    <p:column headerText="余额" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="余额"/>
                        </f:facet>
                        <h:outputText value="#{record.balance}" style="float: right">
                            <f:convertNumber pattern="###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="可用余额" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="可用余额"/>
                        </f:facet>
                        <h:outputText value="#{record.balanceUsable}" style="float: right;">
                            <f:convertNumber pattern="###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="冻结金额" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="冻结金额"/>
                        </f:facet>
                        <h:outputText value="#{record.balanceLock}" style="float: right;">
                            <f:convertNumber pattern="###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="监管状态" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="监管状态"/>
                        </f:facet>
                        <h:outputText value="#{flagStatusForMap.accountStatus[record.statusFlag]}"/>
                    </p:column>

                    <p:column headerText="限制付款" style="text-align:center">
                        <f:facet name="header">
                            <h:outputText value="限制付款"/>
                        </f:facet>
                        <h:outputText value="#{flagStatusForMap.accountLimit[record.limitFlag]}"/>
                    </p:column>

                    <p:column headerText="操作" style="text-align:center">
                        <h:commandLink onclick="recordEdit(this)" value="修改" style="color: blue"/>
                    </p:column>

                </p:dataTable>
            </h:form>
        </div>
    </ui:define>

</ui:composition>